package servletDemo;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
/*
* cookie
*  */

@WebServlet(name = "ServletE", value = "/ServletE")
public class ServletE extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 创建一个cookie对象并设置数据
        Cookie cookie = new Cookie("COOO", "KKKK");
        cookie.setMaxAge(60);
        // 将cookie对象发送给客户端
        response.addCookie(cookie);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
